package com.collabscm.waf.app.web.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.collabscm.waf.solution.Preloader;

/**
 * 加载系统启动前需要预先初始化的内容
 *
 * @author Zeng Raoxing
 */
public class PreloadListener implements ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		String preloadConfig = sce.getServletContext().getInitParameter("preloadConfig");
		if(preloadConfig == null) {
			preloadConfig = "preload-config.xml";
		}
		new Preloader().load(preloadConfig);
	}

}
